package com.ewing.busi.pay.dao;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;

import com.ewing.busi.pay.constants.BusiType;
import com.ewing.busi.pay.model.PayHistory;
import com.ewing.core.jdbc.BaseDao;

@Repository
public class PayHistoryDao {
  /**
   * 默认生成的该类的LOG记录器，使用slf4j组件。避免产生编译警告，使用protected修饰符。
   */
  protected final static Logger LOG = LoggerFactory.getLogger(PayHistoryDao.class);

  @Resource
  private BaseDao baseDao;

  public PayHistory getByBusiIdAndBusiType(Integer busiId, BusiType busiType) {
    StringBuilder condition = new StringBuilder();
    condition.append("busi_id=" + busiId);
    condition.append(" and busi_type='" + busiType.getValue() + "'");
    return baseDao.findOne(condition.toString(), PayHistory.class);
  }


  public PayHistory getByBizIdAndBusiType(String bizId, BusiType busiType) {
    StringBuilder condition = new StringBuilder();
    condition.append("biz_id='" + bizId + "'");
    condition.append(" and busi_type='" + busiType.getValue() + "'");
    return baseDao.findOne(condition.toString(), PayHistory.class);
  }
}
